#include<cstdio>
#include<cstring>
#include<algorithm>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=110,MAXM=6e4+10;
int n,m,p[MAXN],c[MAXN],f[MAXM];
int main()
{
	n=read();m=read();
	memset(f,INF,sizeof(f));
	f[0]=0;
	for(int i=1;i<=n;++i)p[i]=read(),c[i]=read();
	for(int i=1;i<=n;++i)
		for(int j=p[i];j<=m+5000;++j)
			f[j]=min(f[j],f[j-p[i]]+c[i]);
	int ans=INF;
	for(int i=m;i<=m+5000;++i)
		ans=min(ans,f[i]);
	printf("%d\n",ans);
	return 0;
}
